from django.shortcuts import render

# Create your views here.
# -*- coding: utf-8 -*-
from django.shortcuts import render
from django.http import HttpResponse
from .models import Column,Article

def index(request):
    columns = Column.objects.all()
    return render(request, 'news/index.html', {'columns': columns})
    #return HttpResponse( "你好我是c")

def column_detail(request, column_slug):
    column = Column.objects.get(slug=column_slug)
    return render(request, 'news/column.html', {'column': column})


def article_detail(request, article_slug,article_title):

    article = Article.objects.filter(slug=article_slug,title=article_title)[0]

    return render(request, 'news/article.html', {'article': article})